﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  Name="EnvironmentPermission"
  xmlns="http://schemas.microsoft.com/pag/gax-core"
  Bound="false">
  <xi:include href="../../../TypeAlias.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
  <Caption>Environment Permission</Caption>
  <Description>Adds a EnivronmentPermission to the project. Controls access to system and user environment variables.</Description>
  <HostData Priority="200">
    <Icon File="Help/Icons/icon_Advanced.ico" />
    <CommandBar Menu="SPSFSolutionSecurity"/>
    <CommandBar Menu="SPSFProjectSecurity"/>
    <spsf:MetaData
      Visible="true"
      BindingType="CustomizationReference"
      BindingTypeTemplate="CustomizationReferenceTemplate"
      TestType="BaseCustomizationRecipeRunner"
      Enabled="true"
      CreateVSTemplate="false"
      Category="Security" xmlns:spsf="http://www.spalmblogger.de">
      <spsf:Authors>
        <spsf:Author>Torsten Mandelkow</spsf:Author>
      </spsf:Authors>
      <spsf:VersionHistory>
        <spsf:VersionHistoryEntry>1.0 Initial Recipe</spsf:VersionHistoryEntry>
      </spsf:VersionHistory>
      <spsf:WebPageContent>
        <![CDATA[The recipe adds a line for the permission to the Package.Template.xml (for VS 2010 projects) or to the file CASPolicy.txt (for HIVE projects). Warning: Existing permissions with the same name are replaced completely.]]>
      </spsf:WebPageContent>
    </spsf:MetaData>
  </HostData>
  <Arguments>

    <xi:include href="../../BaseArguments.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Arguments/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <xi:include href="BasePermissionArguments.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Arguments/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <Argument Name="EnvironmentRead" >
      <ValueProvider Type="Evaluator" Expression="TEMP;TMP;USERNAME;OS;COMPUTERNAME" />
    </Argument>

    <Argument Name="EnvironmentAllAccess" Required="false" />
    <Argument Name="EnvironmentNoAccess" Required="false" />
    <Argument Name="EnvironmentWrite" Required="false" />    
    
  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page Height="350">
          <Title>Policy Settings</Title>
          <Fields>
            <Field Label="Branding" ValueName="SPSFBranding" PanelType="SPALM.SharePointSoftwareFactory.Library.BrandingPanel, SPALM.SharePointSoftwareFactory.Library" />
            <Field ValueName="EnvironmentRead" Label="Read" >
              <Help>Optional text. Only read access to environment variables is specified. Changing, deleting and creating environment variables is not included in this access level.</Help>
            </Field>
            <Field ValueName="EnvironmentWrite" Label="Write" >
              <Help>Optional text. Only write access to environment variables is specified. Write access includes creating and deleting environment variables as well as changing existing values. Reading environment variables is not included in this access level.</Help>
            </Field>
            <Field ValueName="EnvironmentAllAccess" Label="All Access" >
              <Help>Optional text. Read and Write access to environment variables.</Help>
            </Field>
            <Field ValueName="EnvironmentNoAccess" Label="No Access" >
              <Help>Optional text. No access to environment variables.</Help>
            </Field>
            <Field ValueName="PermissionIsUnrestricted" Label="Unrestricted" >
              <Help>Optional Boolean. If Unrestricted is true, the other settings will be ignored.</Help>
            </Field>         
          </Fields>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions CoordinatorServiceType="ConditionalCoordinator">

    <xi:include href="../../BaseStartingActions.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Actions/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

    <Action
       Name="AddCASPolicyAction"
       Type="AddCASPolicyAction"
       TemplateFileName="Text\Security\EnvironmentPermission.txt.t4">
    </Action>
    
    <xi:include href="../../BaseFinalActions.include" parse="xml" xpointer="xmlns(p=http://schemas.microsoft.com/pag/gax-core) xpointer(/p:Actions/*)" xmlns:xi="http://www.w3.org/2001/XInclude" />

  </Actions>
</Recipe>